/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.app.param.buyer;

import com.shop.cereshop.app.param.index.LoginDTO;
import com.shop.cereshop.commons.config.RsaProperties;
import com.shop.cereshop.commons.utils.RsaUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * 获取验证码请求实体
 */
@Data
@ApiModel(value = "GetCodeParam", description = "获取验证码参数实体")
@Slf4j
public class BuyerGetCodeParam {

    /**
     * 电话
     */
    @ApiModelProperty(value = "电话", required = true)
    private String phone;

    @ApiModelProperty(value = "图形验证码")
    private String code;

    public BuyerGetCodeParam decrypt() throws Exception {
        BuyerGetCodeParam res = this;
        try {
            res.setPhone(RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,this.phone));
        } catch (Exception e) {
            log.error("解密失败");
        }
        return res;
    }
}
